//
//  LabListController.m
//  OCDemo
//
//  Created by BH on 15/9/25.
//  Copyright © 2015年 baohan. All rights reserved.
//

#import "LabListController.h"
#import "NormalController.h"
#import "LinkController.h"
#import "ExpressionController.h"
#import "HtmlController.h"
#import "ListNolibController.h"
#import "GlobalDefine.h"
#import "ClipExpressionController.h"

@interface LabListController ()<UITableViewDataSource,UITableViewDelegate>
{
    NSArray *titleList;
}

@property (weak, nonatomic) IBOutlet UITableView *tableList;
@end

@implementation LabListController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"图文混排";
    
    titleList = [NSArray arrayWithObjects:@"Normal",@"Link",@"Expression",
                 @"Html",@"ListNoNib",@"List",@"ClipExpression",nil];
    self.tableList.tableFooterView = [[UIView alloc] init];
}

#pragma mark - tableview datasource & delegate
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return titleList.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *identiy = @"LabListCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identiy forIndexPath:indexPath];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identiy];
    }
    
    cell.textLabel.text = titleList[indexPath.row];
    
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        PUSH([[NormalController alloc] init]);
    }else if (indexPath.row == 1){
        PUSH([[LinkController alloc] init]);
    }else if (indexPath.row == 2){
        PUSH([[ExpressionController alloc] init]);
    }else if (indexPath.row == 3){
        PUSH([[HtmlController alloc] init]);
    }else if (indexPath.row == 4){
        PUSH([[ListNolibController alloc] init]);
    }else if (indexPath.row == 6){
        PUSH([[ClipExpressionController alloc] init]);
    }else{
    
    }
}

@end
